home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / dde / dde_piz / dde_piz.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-09-28  |  20.9 KB  |  604 lines

  1. VERSION 2.00
  2. Begin Form frmPizza 
  3.    BackColor       =   &H000000C0&
  4.    Caption         =   "VBits-a-Hut"
  5.    ClientHeight    =   4665
  6.    ClientLeft      =   1320
  7.    ClientTop       =   2265
  8.    ClientWidth     =   7365
  9.    Height          =   5355
  10.    Icon            =   DDE_PIZ.FRX:0000
  11.    Left            =   1260
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4665
  14.    ScaleWidth      =   7365
  15.    Top             =   1635
  16.    Width           =   7485
  17.    Begin CommonDialog CMOpenXl 
  18.       Left            =   240
  19.       Top             =   3960
  20.    End
  21.    Begin CommandButton Command1 
  22.       Caption         =   "&New Order"
  23.       Height          =   435
  24.       Left            =   2760
  25.       TabIndex        =   9
  26.       Top             =   120
  27.       Width           =   1500
  28.    End
  29.    Begin Frame grpMethod 
  30.       Caption         =   "Pickup/Delivery"
  31.       Enabled         =   0   'False
  32.       Height          =   1095
  33.       Left            =   4440
  34.       TabIndex        =   11
  35.       Top             =   120
  36.       Width           =   2655
  37.       Begin OptionButton optMethod 
  38.          Caption         =   "&Delivery"
  39.          Enabled         =   0   'False
  40.          Height          =   255
  41.          Index           =   1
  42.          Left            =   240
  43.          TabIndex        =   13
  44.          Top             =   720
  45.          Width           =   1095
  46.       End
  47.       Begin OptionButton optMethod 
  48.          Caption         =   "Pick&up"
  49.          Enabled         =   0   'False
  50.          Height          =   255
  51.          Index           =   0
  52.          Left            =   240
  53.          TabIndex        =   12
  54.          Top             =   360
  55.          Value           =   -1  'True
  56.          Width           =   1935
  57.       End
  58.    End
  59.    Begin CommandButton cmdClear 
  60.       Caption         =   "C&lear Pizza"
  61.       Height          =   495
  62.       Left            =   5160
  63.       TabIndex        =   15
  64.       Top             =   3960
  65.       Width           =   1755
  66.    End
  67.    Begin TextBox txtName 
  68.       Height          =   315
  69.       Left            =   240
  70.       TabIndex        =   1
  71.       Top             =   360
  72.       Width           =   2115
  73.    End
  74.    Begin Frame grpTopping 
  75.       BackColor       =   &H00FFFFFF&
  76.       Caption         =   "&Toppings"
  77.       Height          =   1515
  78.       Left            =   240
  79.       TabIndex        =   2
  80.       Top             =   840
  81.       Width           =   2115
  82.       Begin CheckBox chkTopping 
  83.          BackColor       =   &H00FFFFFF&
  84.          Caption         =   "&Pepperoni"
  85.          Height          =   315
  86.          Index           =   1
  87.          Left            =   120
  88.          TabIndex        =   4
  89.          Top             =   720
  90.          Width           =   1665
  91.       End
  92.       Begin CheckBox chkTopping 
  93.          BackColor       =   &H00FFFFFF&
  94.          Caption         =   "Mu&shrooms"
  95.          Height          =   315
  96.          Index           =   2
  97.          Left            =   120
  98.          TabIndex        =   5
  99.          Top             =   1080
  100.          Width           =   1440
  101.       End
  102.       Begin CheckBox chkTopping 
  103.          BackColor       =   &H00FFFFFF&
  104.          Caption         =   "&Cheese"
  105.          Height          =   315
  106.          Index           =   0
  107.          Left            =   120
  108.          TabIndex        =   3
  109.          Top             =   375
  110.          Width           =   1815
  111.       End
  112.    End
  113.    Begin CommandButton cmdPickup 
  114.       Caption         =   "&Get Pizza"
  115.       Enabled         =   0   'False
  116.       Height          =   495
  117.       Left            =   3000
  118.       TabIndex        =   14
  119.       Top             =   3960
  120.       Width           =   1740
  121.    End
  122.    Begin CommandButton cmdOrder 
  123.       Caption         =   "Place &Order"
  124.       Enabled         =   0   'False
  125.       Height          =   435
  126.       Left            =   2760
  127.       TabIndex        =   10
  128.       Top             =   720
  129.       Width           =   1500
  130.    End
  131.    Begin PictureBox picPizza 
  132.       Height          =   2415
  133.       Left            =   2760
  134.       ScaleHeight     =   2385
  135.       ScaleWidth      =   4335
  136.       TabIndex        =   17
  137.       Top             =   1440
  138.       Width           =   4365
  139.    End
  140.    Begin Frame frmCrust 
  141.       BackColor       =   &H00FFFFFF&
  142.       Caption         =   "Thick or Thin Crust"
  143.       Height          =   1140
  144.       Left            =   240
  145.       TabIndex        =   6
  146.       Top             =   2640
  147.       Width           =   2115
  148.       Begin OptionButton optThick 
  149.          BackColor       =   &H00FFFFFF&
  150.          Caption         =   "&Thick Crust"
  151.          Height          =   315
  152.          Left            =   300
  153.          TabIndex        =   8
  154.          Top             =   675
  155.          Width           =   1440
  156.       End
  157.       Begin OptionButton optThin 
  158.          BackColor       =   &H00FFFFFF&
  159.          Caption         =   "T&hin Crust"
  160.          Height          =   240
  161.          Left            =   300
  162.          TabIndex        =   7
  163.          Top             =   375
  164.          Value           =   -1  'True
  165.          Width           =   1365
  166.       End
  167.    End
  168.    Begin Label lblName 
  169.       BackStyle       =   0  'Transparent
  170.       Caption         =   "Na&me"
  171.       Height          =   240
  172.       Left            =   240
  173.       TabIndex        =   0
  174.       Top             =   120
  175.       Width           =   1440
  176.    End
  177.    Begin Label lblPizza 
  178.       BackStyle       =   0  'Transparent
  179.       Caption         =   "Pizza"
  180.       Height          =   240
  181.       Left            =   2775
  182.       TabIndex        =   16
  183.       Top             =   1200
  184.       Width           =   1140
  185.    End
  186.    Begin Menu mnuFile 
  187.       Caption         =   "&File"
  188.       Begin Menu mnuExit 
  189.          Caption         =   "E&xit"
  190.       End
  191.    End
  192.    Begin Menu mnuPizza 
  193.       Caption         =   "&Pizza"
  194.       Begin Menu mnuPizzaNew 
  195.          Caption         =   "&New Order"
  196.          Shortcut        =   ^N
  197.       End
  198.       Begin Menu mnuPizzaOrder 
  199.          Caption         =   "Place &Order"
  200.          Enabled         =   0   'False
  201.          Shortcut        =   ^O
  202.       End
  203.       Begin Menu mnuPizzaClear 
  204.          Caption         =   "C&lear Pizza"
  205.          Enabled         =   0   'False
  206.          Shortcut        =   ^L
  207.       End
  208.       Begin Menu mnuPizzaSep1 
  209.          Caption         =   "-"
  210.       End
  211.       Begin Menu mnuPizzaOptions 
  212.          Caption         =   "&Pickup"
  213.          Checked         =   -1  'True
  214.          Enabled         =   0   'False
  215.          Index           =   0
  216.          Shortcut        =   ^P
  217.       End
  218.       Begin Menu mnuPizzaOptions 
  219.          Caption         =   "&Delivery"
  220.          Enabled         =   0   'False
  221.          Index           =   1
  222.          Shortcut        =   ^D
  223.       End
  224.       Begin Menu mnuPizzaSep2 
  225.          Caption         =   "-"
  226.       End
  227.       Begin Menu mnuPizzaGet 
  228.          Caption         =   "&Get Pizza"
  229.          Enabled         =   0   'False
  230.          Shortcut        =   ^G
  231.       End
  232.    End
  233.    Begin Menu mnuHelp 
  234.       Caption         =   "&Help"
  235.       Begin Menu mnuHelpAbout 
  236.          Caption         =   "&About"
  237.       End
  238.    End
  239. Option Explicit
  240. 'Form level variables
  241. Dim Man_Auto As Integer
  242. Dim glbPath As String
  243. Dim CurDrive As String
  244. Dim rc As Integer
  245. Dim cnt As Integer
  246. Dim lf As String
  247. Dim flgDDEON As Integer
  248. Dim DDEAPP As String
  249. 'Form level constants
  250. Const NONE = 0
  251. Const AUTOMATIC = 1
  252. Const LINK_MANUAL = 2 ' Declare constants.
  253. Const NOFILE = 53
  254. Const BADCALL = 5
  255. Const BADPATH = 76
  256. Const NOAPP = 282
  257. Const XLFILE = "pizza.xls"
  258. ' WindowState
  259. Const NORMAL = 0    ' 0 - Normal
  260. Const MINIMIZED = 1 ' 1 - Minimized
  261. Const MAXIMIZED = 2 ' 2 - Maximized
  262. Const NORMALWOFOCUS = 4 ' 4 - Normal without Focus
  263. ' Check Value
  264. Const UNCHECKED = 0 ' 0 - Unchecked
  265. Const Checked = 1   ' 1 - Checked
  266. Const GRAYED = 2    ' 2 - Grayed
  267. ' MsgBox parameters
  268. Const MB_OK = 0                 ' OK button only
  269. Const MB_OKCANCEL = 1           ' OK and Cancel buttons
  270. Const MB_ABORTRETRYIGNORE = 2   ' Abort, Retry, and Ignore buttons
  271. Const MB_YESNOCANCEL = 3        ' Yes, No, and Cancel buttons
  272. Const MB_YESNO = 4              ' Yes and No buttons
  273. Const MB_RETRYCANCEL = 5        ' Retry and Cancel buttons
  274. Const MB_ICONSTOP = 16          ' Critical message
  275. Const MB_ICONQUESTION = 32      ' Warning query
  276. Const MB_ICONEXCLAMATION = 48   ' Warning message
  277. Const MB_ICONINFORMATION = 64   ' Information message
  278. Const MB_APPLMODAL = 0          ' Application Modal Message Box
  279. Const MB_DEFBUTTON1 = 0         ' First button is default
  280. Const MB_DEFBUTTON2 = 256       ' Second button is default
  281. Const MB_DEFBUTTON3 = 512       ' Third button is default
  282. Const MB_SYSTEMMODAL = 4096      'System Modal
  283. ' MsgBox return values
  284. Const IDOK = 1                  ' OK button pressed
  285. Const IDCANCEL = 2              ' Cancel button pressed
  286. Const IDABORT = 3               ' Abort button pressed
  287. Const IDRETRY = 4               ' Retry button pressed
  288. Const IDIGNORE = 5              ' Ignore button pressed
  289. Const IDYes = 6                 ' Yes button pressed
  290. Const IDNO = 7                  ' No button pressed
  291. Sub ButtonsON ()
  292.     grpMethod.enabled = True        'Enable Method of Pickup Group
  293.     optMethod(0).enabled = True     'Enable Pickup option button
  294.     optMethod(1).enabled = True     'Enable Pickup option button
  295.     optMethod(0).Value = True     'Enable Pickup option button
  296.     cmdPickup.enabled = True        'Enable Pickup Button
  297.     mnuPizzaOptions(0).enabled = True
  298.     mnuPizzaOptions(1).enabled = True
  299.     mnuPizzaGet.enabled = True
  300.     mnuPizzaClear.enabled = True
  301. End Sub
  302. Sub chkTopping_Click (index As Integer)
  303. If cmdOrder.enabled Then    'Test in Order button on
  304.     Call PlaceOrder     'Call PlaceOrder Subroutine
  305. End If
  306. End Sub
  307. Sub cmdClear_Click ()
  308.     Call myClearPizza
  309. End Sub
  310. Sub cmdOrder_Click ()
  311. Call myPlaceOrder
  312. End Sub
  313. Sub cmdPickup_Click ()
  314.     Call PlaceOrder    'Call PlaceOrder Subroutine
  315.     picPizza.LinkRequest
  316. End Sub
  317. Sub Command1_Click ()
  318. txtName.Text = ""
  319. End Sub
  320. Sub FindGlbPath ()
  321. glbPath = App.Path          'Assign glbPath to current path
  322. If Not Right$(glbPath, 1) = "\" Then     'Check if root dir c:\
  323.     glbPath = glbPath & "\"       'Add a "\" if necessary
  324. End If
  325. CurDrive = Left$(glbPath, 2)
  326. End Sub
  327. Sub Form_Load ()
  328. lf = Chr$(10)   'Variable for line feed in msgboxes
  329. Call FindGlbPath     'Find current path
  330. flgDDEON = False     'Flag DDE on or off
  331. DDEAPP$ = "EXCEL"
  332. Me.Move (screen.Height - Height) \ 2, (screen.Width - Width) \ 2
  333. End Sub
  334. Sub Form_Unload (Cancel As Integer)
  335.     picPizza.LinkMode = NONE        'Clears DDE Connection
  336.     txtName.LinkMode = NONE         'Clears Text Connection
  337. End Sub
  338. Sub GenErr (proc$, errnum%, errstr$)
  339. MsgBox "An unexpected error has occur!!!!" & lf & "Error Number: " & errnum & lf & "Error message: " & errstr, MB_OK, "ERROR!!!"
  340. End Sub
  341. Sub mnuExit_Click ()
  342. Unload Me
  343. End Sub
  344. Sub mnuHelpAbout_Click ()
  345. frmAbout.Show 1
  346. End Sub
  347. Sub mnuPizzaClear_Click ()
  348. Call myClearPizza
  349. End Sub
  350. Sub mnuPizzaGet_Click ()
  351.     Call PlaceOrder    'Call PlaceOrder Subroutine
  352.     picPizza.LinkRequest
  353. End Sub
  354. Sub mnuPizzaNew_Click ()
  355. txtName.Text = ""
  356. txtName.SetFocus
  357. End Sub
  358. Sub mnuPizzaOptions_Click (index As Integer)
  359. optMethod(index).Value = True
  360. End Sub
  361. Sub mnuPizzaOrder_Click ()
  362. Call myPlaceOrder
  363. End Sub
  364. Sub mnuPizzaPickup_Click ()
  365.     Call PlaceOrder    'Call PlaceOrder Subroutine
  366.     picPizza.LinkRequest
  367. End Sub
  368. Sub myChooseMethod (myindex As Integer)
  369. On Error GoTo mychooseMethodErr
  370. Select Case myindex    'Click Pickup pizza
  371.     Case 0
  372.     cmdPickup.enabled = True        'Set Pickup button to enabled
  373.     mnuPizzaGet.enabled = True      'Enables Get menu
  374.     picPizza.LinkMode = NONE        'Clear DDE Channel
  375.     picPizza.LinkMode = LINK_MANUAL     'Set DDE to Manual
  376.     mnuPizzaOptions(0).Checked = True
  377.     mnuPizzaOptions(1).Checked = False
  378.     Case 1           'Click Deliver pizza
  379.     cmdPickup.enabled = False       'Set Pickup button to disabled
  380.     mnuPizzaGet.enabled = False      'Disable Get menu
  381.     picPizza.LinkMode = NONE        'Cleat DDE Channel
  382.     picPizza.LinkMode = AUTOMATIC   'Set DDE to AUTOMATIC
  383.     mnuPizzaOptions(0).Checked = False
  384.     mnuPizzaOptions(1).Checked = True
  385. End Select
  386. Exit Sub
  387. mychooseMethodErr:
  388.     GenErr "startxl", Err, Error$
  389.     End
  390. End Sub
  391. Sub myClearAll ()
  392.     flgDDEON = False          'Flag that indicates no DDE
  393.     picPizza.LinkMode = NONE   'Clear DDE channel
  394.     picPizza.LinkTopic = ""
  395.     picPizza.LinkItem = ""
  396.     picPizza.LinkMode = NONE   'Clear DDE channel
  397.     picPizza = LoadPicture("")   'Clear picture box
  398.     txtName.Text = ""            'Clear order name text box
  399.     For cnt = 0 To 2             'Loop through all check boxes
  400.     chkTopping(cnt).Value = UNCHECKED    'Set value to unchecked
  401.     Next
  402.     optMethod(0).Value = True       'Reset buttons
  403.     grpMethod.enabled = False
  404.     optMethod(0).enabled = False
  405.     optMethod(1).enabled = False
  406.     cmdPickup.enabled = False
  407.     mnuPizzaOptions(0).enabled = False
  408.     mnuPizzaOptions(1).enabled = False
  409.     mnuPizzaGet.enabled = False
  410.     mnuPizzaClear.enabled = False
  411. End Sub
  412. Sub myClearPizza ()
  413. If optMethod(0).Value = True Then
  414.     picPizza = LoadPicture("")   'Clear picture box
  415.     MsgBox "You can not clear the pizza when you have free delivery.  The pizza keeps coming."
  416. End If
  417. End Sub
  418. Sub myPlaceOrder ()
  419. On Error GoTo errcmdOrder_Click     'Error Trap
  420. startAGain:                         'Label incase of Error
  421.     picPizza.LinkMode = NONE        'Clear DDE Connection
  422.     picPizza = LoadPicture("")   'Clear picture box                                    'Clears Picture
  423.     'Set LinkTopic to excel and file in excel
  424.     picPizza.LinkTopic = "Excel|[pizza.xls]sheet1 pizza"   ' Set link topic.
  425.     picPizza.LinkItem = "pizza"       ' Set link item to chart in xl.
  426.     picPizza.LinkMode = LINK_MANUAL   ' Set link mode to Manual.
  427.     flgDDEON = True                   'Set flgDDE to True
  428.     Call PlaceOrder         'Call PlaceOrder subroutine
  429.     Call ButtonsON          'Call ButtonsOn subroutine
  430. Exit Sub                    'Exit Sub so not to fall in Error trap
  431. errcmdOrder_Click:          'Label for Error trap
  432.     If Err = NOAPP Then     'Test if Err NOAPP (282)
  433.     rc = myStartDDE()      'Try starting xl by calling Startxl procedure
  434.     If rc = False Then  'If can't start xl then end Application
  435.         End             'Ends App
  436.     Else                'Else try DDE connection again
  437.        Resume startAGain     'Resume at StartAgain label
  438.     End If
  439.     Else                    'If not NoApp err call GenErr
  440.     GenErr "cmdOrder_Click", Err, Error$   'GenErr pass procedure name, err and err msg
  441.     End If
  442. End Sub
  443. Function myStartDDE () As Integer
  444. Dim xlRun As Integer
  445. On Error GoTo ErrDDE:
  446. DDEStart:
  447. picPizza.LinkMode = NONE     'Clear DDE channel
  448. 'Set LinkTopic to Excel, App is Excel
  449. 'Topic is System which means general Excel no file
  450. picPizza.LinkTopic = "Excel|system"
  451. 'Set LinkTimeout to 10 seconds
  452. picPizza.LinkTimeout = 1000
  453. 'Set LinkMode to manual
  454. picPizza.LinkMode = LINK_MANUAL    ' Set link mode.
  455. 'LinkExecute to Open a file in Excel
  456. picPizza.LinkExecute "[Open(""" & glbPath & XLFILE & """)]"
  457. myStartDDE = True       'Set Startxl to true
  458. DoEvents             'Doevents lets xl startup successfully
  459. Exit Function        'Exit Function prevents fall thru to error trap
  460. ErrDDE:
  461. If Err = NOAPP Then
  462.     xlRun = myStartXL()           'Start Excel
  463.     If xlRun = True Then          'Test is EXCEl is running
  464.     Resume DDEStart           'Try to DDE again
  465.     Else
  466.     myStartDDE = False         'Set startxl flag to false
  467.     Exit Function             'End function
  468.     End If
  469. Else        'if unexpect error call GenErr
  470.     GenErr "startxl", Err, Error$
  471. End If
  472. End Function
  473. Function myStartXL () As Integer
  474. Dim App As String
  475. Dim z As Variant
  476. Dim trycnt As Integer
  477. Dim rc As Integer
  478. On Error GoTo errStartxl    'Set Error Trap
  479.     App$ = "EXCEL"
  480.     z = Shell(App$, MINIMIZED)  'Start xl with shell function
  481.     'If can't open and error will occur
  482.     myStartXL = True
  483. Exit Function
  484. errStartxl:
  485. If Err = NOFILE Or Err = BADCALL Or Err = BADPATH Then        'Test err to see if found xl
  486. trycnt% = trycnt% + 1         'if Shell fails it is because Excel not in path
  487. Select Case trycnt%
  488. Case 1     'Try to see if Excel is in default locaton
  489.     App$ = CurDrive & "\EXCEL\EXCEL.EXE"
  490.     Resume 'Try shell again
  491. Case 2     'Try to see if Excel is in default MSOffice location
  492.     App$ = CurDrive & "\MSOffice\EXCEL\EXCEL.EXE"
  493.     Resume 'Try shell again
  494. Case 3     'Try to see if Excel is in default MSOffice location
  495.     App$ = CurDrive & "\EXCEL5\EXCEL.EXE"
  496.     Resume 'Try shell again
  497. Case Else       'Call Open Dialog Box and have user find EXCEL
  498.     Do
  499.     'Set Filter to check for EXCEL
  500.     cmOpenxl.Filter = "Programs (*.exe)|*.exe|All files (*.*)|*.*"
  501.     cmOpenxl.Filename = ""      'Reset Filename to empty
  502.     cmOpenxl.Action = 1         'Call the OPen dialog box
  503.     App$ = cmOpenxl.Filename    'Set App$ to filename choosen
  504.     If Len(App$) > 0 Then
  505.         If cmOpenxl.Filetitle = DDEAPP$ & ".EXE" Then
  506.         Exit Do       'Test if enter a name or cancel
  507.         ElseIf cmOpenxl.Filetitle <> DDEAPP$ & ".EXE" Then
  508.         MsgBox "You have selected a file that is not " & DDEAPP$ & ".", MB_ICONEXCLAMATION, "OOPS"
  509.         ElseIf Right$(cmOpenxl.Filetitle, 4) <> ".EXE" Then
  510.         MsgBox "This file is not a executeable.", MB_ICONEXCLAMATION, "OOPS"
  511.         End If
  512.         App$ = ""               'Clear out App so no shell will occur
  513.     End If
  514.     Loop While MsgBox("Please find the application Excel or hit cancel to end application", MB_OKCANCEL + MB_ICONQUESTION, "Find Excel") = IDOK
  515.     'Test if found Excel or hit cancel
  516.     If Len(App$) > 0 Then
  517.     Resume
  518.     Else
  519.     MsgBox "Excel must be loaded to order pizza." & lf & lf & "Sorry" & lf & "Please check if Excel is on your machine.", MB_ICONSTOP
  520.     myStartXL = False         'Set startxl flag to false
  521.     Exit Function             'End function
  522.     End If
  523. End Select
  524. Else        'if unexpect error call GenErr
  525.     GenErr "startxl", Err, Error$
  526. End If
  527. End Function
  528. Sub optMethod_Click (index As Integer)
  529. If flgDDEON = True Then
  530.     Call myChooseMethod(index)
  531. End If
  532. End Sub
  533. Sub optPickup_Click ()
  534. End Sub
  535. Sub optThick_Click ()
  536. If cmdOrder.enabled Then    'Test in Order button on
  537.      Call PlaceOrder        'Call PlaceOrder subroutine
  538. End If
  539. End Sub
  540. Sub optThin_Click ()
  541. If cmdOrder.enabled Then
  542.     Call PlaceOrder     'Call PlaceOrder Subroutine
  543. End If
  544. End Sub
  545. Sub PlaceOrder ()
  546. Dim cnt As Integer
  547. Dim chn As Integer
  548. Dim topvalue As Integer
  549. On Error GoTo ddefail      'Set Error Trap
  550. If flgDDEON = False Then   'Test flag to see in DDE chnl
  551.     Exit Sub               'If no chnl end sub
  552. End If
  553. starthere:                 'Label for Error Trap
  554.     txtName.LinkMode = NONE              'Clear DDE channel
  555.     txtName.LinkTopic = "Excel|[pizza.xls]sheet1"   ' Set link topic.
  556.     txtName.LinkItem = "name"               ' Set link item.
  557.     txtName.LinkMode = LINK_MANUAL          ' Set link mode.
  558.     txtName.LinkPoke                        ' Put name in xl
  559.     'txtName.LinkMode = NONE               'Clear DDE channel
  560.     'Pass all the pizza info to xl through DDE Executes
  561.     picPizza.LinkExecute "[select(""Cheese"")]"
  562.     If chkTopping(0).Value = 1 Then topvalue = 1 Else topvalue = 0
  563.     picPizza.LinkExecute "[Formula(" & topvalue & ")]"
  564.     picPizza.LinkExecute "[select(""Pepperoni"")]"
  565.     If chkTopping(1).Value = 1 Then topvalue = 1 Else topvalue = 0
  566.     picPizza.LinkExecute "[Formula(" & topvalue & ")]"
  567.     picPizza.LinkExecute "[select(""Mushrooms"")]"
  568.     If chkTopping(2).Value = 1 Then topvalue = 1 Else topvalue = 0
  569.     picPizza.LinkExecute "[Formula(" & topvalue & ")]"
  570.     If optthin.Value = True Then
  571.     picPizza.LinkExecute "[Run(""Thin"")]"     'Runs xl macro in sheet
  572.     Else
  573.     picPizza.LinkExecute "[Run(""Thick"")]"    'Runs xl macro in sheet
  574.     End If
  575. Exit Sub
  576. ddefail:
  577.     If Err = NOAPP Then     'Test if Err NoApp (282)
  578.     rc = myStartXL()      'Try starting xl by calling Startxl procedure
  579.     If rc = False Then  'If can't start xl then end Application
  580.         End             'Ends App
  581.     Else                'Else try DDE connection again
  582.        Resume starthere     'Resume at StartAgain label
  583.     End If
  584.     Else                    'If not NoApp err call GenErr
  585.     GenErr "PlaceOrder", Err, Error$   'GenErr pass procedure name, err and err msg
  586.     End If
  587. End Sub
  588. Sub txtName_Change ()
  589.     If Len(txtName) = 0 Then     'Test is text box blank
  590.     cmdOrder.enabled = False 'Set order button to disabled
  591.     mnuPizzaOrder.enabled = False
  592.     Call myClearAll          'Call ClearAll subroutine
  593.     Else
  594.     If flgDDEON = False Then
  595.     cmdOrder.enabled = True
  596.         mnuPizzaOrder.enabled = True
  597.     Else
  598.         txtName.LinkPoke                        ' Put name in xl
  599.     End If
  600.     End If
  601. End Sub
  602. Sub UpdateName ()
  603. End Sub
  604.